This is an example tutorial to use my module bhishan for the plotly extension for pandas.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%load_ext autoreload
%load_ext watermark
%autoreload 2
%watermark -a "Bhishan Poudel" -d -v -m
%watermark -iv
Author: Bhishan Poudel Python implementation: CPython Python version : 3.11.7 IPython version : 8.20.0 Compiler : MSC v.1937 64 bit (AMD64) OS : Windows Release : 10 Machine : AMD64 Processor : Intel64 Family 6 Model 141 Stepping 1, GenuineIntel CPU cores : 16 Architecture: 64bit seaborn : 0.13.0 pandas : 1.5.3 numpy : 1.26.3 matplotlib: 3.8.2
# my local library
import sys
from pathlib import Path
import platform
if platform.system() == 'Windows':
p = Path("~/OneDrive - AmerisourceBergen(ABC)/bhishan").expanduser()
elif platform.system() == 'Darwin':
p = Path.home() / "Dropbox/a00_Bhishan_Modules"
sys.path.append(str(p))
from bhishan import bp
tips = sns.load_dataset('tips')
tips.head()
| total_bill | tip | sex | smoker | day | time | size | |
|---|---|---|---|---|---|---|---|
| 0 | 16.99 | 1.01 | Female | No | Sun | Dinner | 2 |
| 1 | 10.34 | 1.66 | Male | No | Sun | Dinner | 3 |
| 2 | 21.01 | 3.50 | Male | No | Sun | Dinner | 3 |
| 3 | 23.68 | 3.31 | Male | No | Sun | Dinner | 2 |
| 4 | 24.59 | 3.61 | Female | No | Sun | Dinner | 4 |
tips.bp.plotly_countplot('day')
diamonds = sns.load_dataset('diamonds')
diamonds.bp.plotly_corr('price',topN=4)
C:\Users\a126291\OneDrive - AmerisourceBergen(ABC)\bhishan\bhishan\plot_plotly.py:434: FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version, it will default to False. Select only valid columns or specify the value of numeric_only to silence this warning.
titanic = sns.load_dataset('titanic')
titanic.bp.plotly_boxplot('age')
None
bp.show_methods(bp,contains='charts')
| 0 | 1 | 2 | |
|---|---|---|---|
| 0 | Plotly_Charts |
Chart = bp.Plotly_Charts(titanic, exclude=["pclass"], target="survived")
charts = Chart.make_charts()
HTML(value='<h1> Interactive Data Visualization using Plotly. </h1>')
Tab(children=(Output(), Output(), Output(), Output(), Output(), Output(), Output()), selected_index=0, titles=…